/* 
  Copyright (c) SilverLining 2015
  Date:    2016-1-7
  File:    BadResultException.h  
  Description: 
	Header for the native exception wrapper.
*/

#pragma once

namespace SL
{
	namespace M
	{
		/// <summary>
		/// Represent a exception which likely observed in native code and containing an error.
		/// </summary>
		[Serializable]
		public ref class BadResultException : System::ApplicationException, System::Runtime::Serialization::ISerializable
		{
		public:
			BadResultException();
			BadResultException(System::String^ message);
			BadResultException(System::String^ message, Exception^ inner);
			BadResultException(int errorCode, System::String^ message);
			BadResultException(const m::bad_result_exception* inner);

			virtual void GetObjectData(SerializationInfo^ info, StreamingContext context) new;

			/// <summary>
			/// The error code of the exception.
			/// </summary>
			property int ErrorCode
			{
				/// <summary>
				/// Return the error code of the exception.
				/// </summary>
				/// <returns>An integer error code.</returns>
				int get();
			}

			String^ ToString() override;

			/// <summary>
			/// Re-throw this exception as a win32 exception.
			/// </summary>
			void RethrowAsWin32Exception();

		protected:
			BadResultException(SerializationInfo^ info, StreamingContext context);
		private:
			int _Error;
		};
	}
}